import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Homepage from "../views/homepage/Homepage.vue";
import EmptyPage from "../views/dashboard/EmptyPage.vue";
import operate from "./operate";
import goods from "./goods";
import promotion from "./promotion";
import system from "./system";


Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
    redirect: "/homepage",
    children: [
      {
        path: "/homepage",
        name: "Homepage",
        component: Homepage,
      },
      {
        path: "/emptypage/:id*",
        name: "EmptyPage",
        component: EmptyPage,
      },
      // 首页结束
    ],
  },
  // 商品管理开始
  {
    path: "/goods",
    name: "商品管理",
    component: () => import("../views/Home.vue"),
    children: [...goods],
  },
  // 商品管理结束
  // 运营管理路由开始
  {
    path: "/operate",
    name: "运营管理",
    component: () => import("../views/Home.vue"),
    children: [...operate],
  },
  // 运营管理路由结束
  // 推广管理开始
  {
    path: "/promotion",
    name: "推广管理",
    component: () => import("../views/Home.vue"),
    children: [...promotion],
  },
  // 推广管理结束
  // 系统管理开始
  {
    path: "/system",
    name: "系统管理",
    component: () => import("../views/Home.vue"),
    children: [...system],
  },
  // 系统管理结束
  {
    path: "/login",
    name: "Login",
    component: () =>
      import( "../views/Login.vue"),
  },
];


const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});


export default router;
